import React, { PureComponent,Fragment } from 'react'

export default class Demo extends PureComponent {
    state={lover: '123', children: ['a', 'b', 'c']}
    changeLover = () => {
        this.setState({
            lover: '456'
        })
    }
    makeChild = ()=>{
        this.state.children.push('d')
        this.setState({children: [...this.state.children]})
    }
  render() {
    console.log('parent render====>')
    return (
    <Fragment>
      <div>Dream Lover：{this.state.lover}</div>
      <div>Children：{this.state.children}</div>
      <button onClick={this.changeLover}>changeLover</button>
      <button onClick={this.makeChild}>makeChild</button>
      <Child children={this.state.children}/>
    </Fragment>
    )
  }
}

class Child extends PureComponent{
    render(){
        console.log('child render====>')
        return <div>父组件传来的数据：{this.props.children}</div>
    }
}